package org.chen.controller;

import org.chen.common.ChatHistory;
import org.chen.common.UserQuery;
import org.chen.dto.ClearClientDto;
import org.chen.result.BaseResponse;
import org.chen.result.CommonResponse;
import org.chen.result.ResultBody;
import org.chen.service.ChatHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/chatHistory")
public class ChatHistoryController {
    @Autowired
    private ChatHistoryService chatHistoryService;

    @PostMapping("/getChatHistory")
    private ResultBody<BaseResponse<List<ChatHistory>>> getChatHistory(@RequestBody ChatHistory chatHistory){
        return ResultBody.success(chatHistoryService.getChatHistory(chatHistory));
    }

    @PostMapping("/saveChatHistory")
    private ResultBody<CommonResponse> saveChatHistory(@RequestBody ChatHistory chatHistory){
        return ResultBody.success(chatHistoryService.saveChatHistory(chatHistory));
    }

    @PostMapping("/deleteBatch")
    private ResultBody<CommonResponse> deleteBatch(@RequestBody ClearClientDto clearClientDto){
        return ResultBody.success(chatHistoryService.deleteBatch(clearClientDto));
    }
}
